<?php
	/* This example shows you how to validate billing and shipping information for fraud.
	 * This sample code use the free fraud checking
	 * service from http://www.fraudlabspro.com (the Micro Plan)
	 * 
	 * Before running this code, you must
	 *  - register an account in FraudLabsPro.com and have a valid API key
	 * 
	 * Additional notes:
	 *  - This sample included a version of PHP library for FraudLabsPro.class.php classes.
	 *    Please visit the official site http://www.fraudlabspro.com for the latest version.
	 * 
	 */
	 
	require ("FraudLabsPro.class.php");
	
	// Create FraudLabs Pro object
	// Note: Sign up for a free API key at http://www.fraudlabspro.com/sign-up 
	// if you do not have one
	$flp = new FraudLabsPro("<fraudlabspro_api_key>");
	
	/////////////////////////////////////////////////
	// Get the order information entered
	$flp->flpRequest->billingCity = "New York";
	$flp->flpRequest->billingZIPCode = "00001";
	$flp->flpRequest->billingState = "New York";
	$flp->flpRequest->billingCountry = "US";
	$flp->flpRequest->shippingAddress = "1-2-3 Street A";
	$flp->flpRequest->shippingCity = "New York";
	$flp->flpRequest->shippingZIPCode = "30002";
	$flp->flpRequest->shippingState = "NY";
	$flp->flpRequest->shippingCountry = "US";
	$flp->flpRequest->amount = 123.00;
	$flp->flpRequest->quantity = 2;
	$flp->flpRequest->currency = 'USD';
	$flp->flpRequest->paymentMode = 'creditcard';
	
	//Perform fraud check
	$result = $flp->fraudCheck();
	
	//Display the result
	if ($flp->flpResponse->isBillShipCountryMatch == "Y")
		echo "Is Billing Country match the Shipping Country: Yes<br/>";
	else if ($flp->flpResponse->isBillShipCountryMatch == "N")
		echo "Is Billing Country match the Shipping Country: No<br/>";
	
	if ($flp->flpResponse->isBillShipStateMatch == "Y")
		echo "Is Billing State match the Shipping State: Yes<br/>";
	else if ($flp->flpResponse->isBillShipStateMatch == "N")
		echo "Is Billing State match the Shipping State: No<br/>";
		
	if ($flp->flpResponse->isBillShipCityMatch == "Y")
		echo "Is Billing City match the Shipping City: Yes<br/>";
	else if ($flp->flpResponse->isBillShipCityMatch == "N")
		echo "Is Billing City match the Shipping City: No<br/>";
		
	if ($flp->flpResponse->isBillShipPostalMatch == "Y")
		echo "Is Billing Postal match the Shipping Postal: Yes<br/>";
	else if ($flp->flpResponse->isBillShipPostalMatch == "N")
		echo "Is Billing Postal match the Shipping Postal: No<br/>";
		
	if ($flp->flpResponse->isAddressShipForward == "Y")
		echo "Is the address a Ship Forward or P.O.Box: Yes<br/>";
	else if ($flp->flpResponse->isBillShipPostalMatch == "N")
		echo "Is the address a Ship Forward or P.O.Box: No<br/>";
	
	if ($flp->flpResponse->isHighRiskCountry == "Y")
		echo "Is the billing country is a high risk country: Yes<br/>";
	else if ($flp->flpResponse->isHighRiskCountry == "N")
		echo "Is the billing country is a high risk country: No<br/>";
	
	unset($flp);
?>
